package com.example.test.config;

import com.example.test.suppert.dao.SnowflakeIdWorker;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Random;

/**
 * Created by lsl on 2021/3/8.
 */
@Configuration
public class SnowflakeIdWorkerConfig {

    private Random random = new Random();

    @Bean
    public SnowflakeIdWorker getSnowflakeId() {
        return new SnowflakeIdWorker(random.nextInt(32), random.nextInt(32));
    }
}
